package com.example.speeddating.mapper;

import com.example.speeddating.entity.EmailCode;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author tina
 * @since 2023-07-20 10:56:04
 */
@Mapper
public interface EmailCodeMapper extends BaseMapper<EmailCode> {

    @Update(value = "update email_code set status = 1 where email = #{email} and status = 0")
    void disableEmailCode(String email);

    @Select(value = "select * from email_code where email = #{email} and code = #{code} and status = 0")
    EmailCode checkCode(String email, String code);
}
